from django.db import models
from User.models import User

# Create your models here.
from utils.dateFun import getNowTimeStamp


class BindRelationship(models.Model):
    """
    用户关系绑定表
    """
    id = models.CharField(verbose_name='绑定ID', max_length=255, null=False, primary_key=True)
    wardUser = models.ForeignKey(verbose_name='被监护人ID', to=User, to_field='uid', on_delete=models.CASCADE,
                                 related_name="wardUserId")
    guardianUser = models.ForeignKey(verbose_name='监护人ID', to=User, to_field='uid', on_delete=models.CASCADE,
                                     related_name="guardianUserId")
    creatTimeStamp = models.CharField(verbose_name='创建时间', max_length=255, null=True, default=getNowTimeStamp())

    class Meta:
        db_table = 'BindRelationship'
        verbose_name = '用户关系绑定表'


class DynamicRecord(models.Model):
    """
    被监护人动态记录表
    """
    id = models.CharField(verbose_name='动态记录ID', max_length=255, null=False, primary_key=True)
    type = models.CharField(verbose_name='动态类型', max_length=255, null=False)
    content = models.TextField(verbose_name='动态内容', null=False)
    isRead = models.BooleanField(verbose_name='是否已读', null=True, default=False)
    creatTimeStamp = models.CharField(verbose_name='创建时间', max_length=255, null=True, default=getNowTimeStamp())
    wardUser = models.ForeignKey(verbose_name="被监护人ID", to=User, to_field='uid', on_delete=models.CASCADE)

    class Meta:
        db_table = 'DynamicRecord'
        verbose_name = '被监护人动态记录表'
